package event

import (
	"api/app/wms/auto/v1/mc"
	"api/app/wms/models"
	"context"
	"gitee.com/dreamwood/ez"
)

func init() {
	ez.ListenJoin(mc.ItemAttributeEventAfterSave, func(v interface{}, ctx context.Context) {
		md, ok := v.(*models.ItemAttribute)
		if ok {
			md.Attribute = &models.AttributeKey{Id: md.AttributeId}
			md.Attribute.Read()
			md.Name = md.Attribute.Name
			md.Save(false)
		}
	})
}
